#include <stdio.h>
#include <string.h>
void main()
{
    int i=0,flag=1;
    char s[10]={0};
    char str[]="i am from nanjing";
    exchange(str,strlen(str));
    exchange2(str);
    printf("%s\n",str);
}
void exchange(char *s,int len)
{
    char a;
    for(int i=0;i<len/2;i++)
    {
        a=s[i];
        s[i]=s[len-1-i];
        s[len-1-i]=a;
    }
}
void exchange2(char *s)
{
    int count=0;
    int start=0;
    for(int i=0;i<=strlen(s);i++)
    {
        if(s[i]==' '||s[i]=='\0')
        {
            exchange(s+start,count);
            start=start+count+1;
            count=0;
        }
        else

            count++;
    }
}